fix(gui): Smoothening startup Part I #355
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I think this renders best if split in two pull requests: one dealing with the lower level code (this one) and another dealing with the visible parts of the user interface. This way it's easier for reviewers and also unblocks @EduardGomezEscandell's work more quickly.
So in this PR we reduce the duration of a timeout in case no changes in the startup state machine happen and we watch for the creation of the
addr
file. The watch only happens in the code path that causes the GUI to start the agent. For the watch operation to happen we need the directory to exist, so I added a precaution step to create it. It doesn't fail in case the directory already exists. It's important that we start watching the directory before launching the agent, otherwise race conditions could happen. Thus we start watching first, then launch the agent, and finally wait for the watching operation to complete (which may have completed by the time we start waiting, which is not a problem at all). This prevents the GUI from spawning more than one agent process.The last commit increases the timeout of one specific end-to-end test because I could see it failing before in CI killing the context, although I could never reproduce it locally not even with VMs.